var father = document.getElementsByClassName("c3_top")[0];
var figs = father.getElementsByTagName("figure");

for (var i = 0; i < figs.length; i++) {
    figs[i].onmouseover = function () {
        for (var i = 0; i < figs.length; i++) {
            figs[i].className = "";
        }
        this.className = "active";

    }
}

var cen = document.getElementsByClassName("con3_cen")[0];
var persons = cen.getElementsByTagName("figure");

for (var i = 0; i < persons.length; i++) {
    persons[i].onmouseover = function () {
        for (var i = 0; i < persons.length; i++) {
            persons[i].className = "";
            persons[i].children[1].className = "";
            var s = persons[i].children[1].children;
            s[0].className = "fig_h2";
            s[1].className = "fig_p"
        }
        this.className = "active";
        this.children[1].className = "active";
        var s = this.children[1].children;
        s[0].className = "fig_h2 active";
        s[1].className = "fig_p active"
    }
}

var map = new BMapGL.Map("allmap");


var point = new BMapGL.Point(106.529655, 29.60753);
map.centerAndZoom(point, 15);

var marker = new BMapGL.Marker(point);
map.addOverlay(marker); 
var opts = {
    width: 200,
    height: 100,
    title: "北城阳光尚线",
    message: "这里是我家"
}
var infoWindow = new BMapGL.InfoWindow("地址：重庆市渝北区.阳光尚线(星辰路西100米)", opts);
marker.addEventListener("click", function () {
    map.openInfoWindow(infoWindow, point);
});

var btns = banner.getElementsByTagName("button"), imgs = banner.getElementsByTagName("img"), lis = banner.getElementsByTagName("li");
var count = 0;
for (var i in btns) {
    btns[i].onclick = function () {
        if (this.innerHTML == "&gt;") {
            banner_1(1);
        } else {
            banner_1(-1);
        }
    }
}

function banner_1(x, obj) {
    if (x) {
        count += x;
        if (count > 3) {
            count = 0;
        } else if (count < 0) {
            count = 3;
        }
        for (var i in lis) {
            lis[i].className = "";
            imgs[i].className = "";
        }
        lis[count].className = "active";
        imgs[count].className = "active";
    } else {
        for (var i in lis) {
            lis[i].className = "";
            imgs[i].className = "";
        }
        obj.className = "active";
        count = parseInt(obj.getAttribute("tx"));
        imgs[count].className = "active";
    }
}
for (var i in lis) {
    lis[i].onclick = function () {
        banner_1(0, this);
    }
}
timer = setInterval(function () {
    banner_1(1);
}, 1500);

banner.onmouseover = function () {
    clearInterval(timer);
}
banner.onmouseout = function () {
    timer = setInterval(function () {
        banner_1(1);
    }, 1500);
}